package context;

import beans.XmlBeanDefinitionReader;
import factory.BeanDefinitionRegisty;
import resource.ResourceLoader;

/**
 * Created by inuyasha on 18-3-22.
 */
public class ClassPathApplicationContext extends AbstractApplicationContext {

    private String location;

    public ClassPathApplicationContext(String location){
        this.location = location;
        try {
            refresh();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    protected void loadBeanDefinition(BeanDefinitionRegisty registy) throws Exception {
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registy, new ResourceLoader());
        reader.loadBeanDefinition(location);
    }
}
